// commons/diy/attr-picker/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    goods_info: {
      type: Object,
      value: {}
    },
    attr_group: {
      type: Object,
      value: {}
    },
    attr_group_list: {
      type:Array,
      value: []
    },
    goods_num: {
      type: Number,
      value: 1
    }
  },
  ready: function () {
    this.setData({
      __wxapp_img: wx.getStorageSync('wxapp_img')
    })
    if (this.properties.goods_info.shop_count > 0) {
      var that = this;
      this.setData({
        goods_num: that.properties.goods_info.shop_count
      })
    }
  },
  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    numberBlur:function (t) { console.log(t)
      this.triggerEvent('numberBlur',t.currentTarget.dataset);
    },
    numberAdd:function () {
      this.triggerEvent('numberAdd');
    },
    numberSub:function () {
      this.triggerEvent('numberSub');
    },
    attrGoodsClick: function (t) {
      this.triggerEvent('attrGoodsClick',t.currentTarget.dataset)
    },
    hideAttrPicker: function () { console.log('dddsssaaa');
      this.triggerEvent('hideAttrPicker',{})
    },
    addToCart: function () {
      this.triggerEvent('addToCart')
    },
    goodsQrcodeClick: function(t) {
      var a = t.currentTarget.dataset.src;
      console.log(t);
      wx.previewImage({
        urls: [a]
      });
    },
    // numberBlur:function () {
    //   this.triggerEvent('numberBlur');
    // }
  }
})
